import { createRouter, createWebHistory, createWebHashHistory  } from 'vue-router'
// createRouter用于创建路由事例
// 1. history模式 ： createWebHistory
// 2. hash模式 ： createWebHashHistory
// vite 中的环境变量 improt.meta.env.BASE_URL 就是vite.config.js中的配置文件
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      component: () => import('@/views/layout/Layout.vue'),
      redirect: '/layout/transferencelist',
      children: [
        {
          path: '/layout/transferencelist',
          component: () => import('@/views/layout/TransferenceList.vue')
        },
        {
          path: '/layout/hirelist',
          component: () => import('@/views/layout/HireList.vue')
        },
        {
          path: '/layout/seekingrentlist',
          component: () => import('@/views/layout/SeekingRentList.vue')
        }
      ]
    },
      // 一级路由详情页
    { path: '/shopdetails', component: () => import('@/views/ShopDetails.vue') },
    { path: '/rentdetails', component: () => import('@/views/RentDetails.vue') },

  ]
})

export default router
